<%@import=import time,sets%>
<div class="menu">
<p><span style="color: gray;"><span style="font-weight: bold;"><%=self.User.userid%></span> (<a href="login?logout=yes">logout</a>)</span>
<br><span style="color: gray; font-size: 80%;"><%=time.ctime()%>
<br><%='%s:%d' % self.getWebApp().getVirtualHost() %></span>
</p>
<p><span style="font-size: large;">&bull;</span> Server:<br><a href="serverinfo"> Server info &raquo;</a></p>
<p><span style="font-size: large;">&bull;</span> WebApps - available:<br><a href="webapps"> Show list &amp; vhosts &raquo;</a></p>
<p><span style="font-size: large;">&bull;</span> WebApps - deployed:<br>

<%
def showWA(webapp,enabled, url, virtualhost):%> 
	<span class="light-<%=enabled%>">&bull;</span>
	<strong><a href="webappinfo?vhost=<%=self.urlescape(virtualhost)%>&amp;name=<%=self.urlescape(url)%>"><%=url%></a></strong><br>
<sup>&nbsp;&nbsp;&nbsp;&nbsp; <a href="webappinfo?name=<%=self.urlescape(url)%>&amp;vhost=<%=self.urlescape(virtualhost)%>"><%=webapp.getName()[1]%></a></sup><br>
<%end%>


<%
vhosts = self.getWebApp().server.virtualHosts
wroots = self.getWebApp().server.webRoots


allVhosts = sets.Set(vhosts.keys())
allVhosts.update(wroots.keys())

allVhosts = list(allVhosts)
allVhosts.sort()

for vhost in allVhosts:
	self.write('<br><span class="vhost">'+vhost+'</span><br>')
	# first, check for  a root webapp
	wa=wroots.get(vhost)
	if wa:
		if wa.isEnabled():
			enabled='enabled'
		else:
			enabled='disabled'
		showWA(wa, enabled,wa.getURLprefix(),vhost)
	# show other webapps
	if vhost in vhosts:
		webapps=[ (webapp.getURLprefix(), webapp) for webapp in vhosts[vhost] ]
		webapps.sort()
		for (url, wa) in webapps:
			if wa.isEnabled():
				enabled='enabled'
			else:
				enabled='disabled'
			showWA(wa, enabled, url ,vhost)

%>

</p>
<div class="createnotice">This server is running <a href="http://www.python.org">Python</a>
with <a href="http://snakelets.sourceforge.net">Snakelets</a> software, created by
<a href="http://irmen.razorvine.net">Irmen de Jong</a>.</div>
</div>
